import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter_kit_plus/flutter_kit.dart';
import 'package:pipedream_lighting/src/home/my_home.dart';

Future<void> main() async {
  /// 捕获所有未捕获的 Dart 异常
  LogManager.initFireBase(runMain: () async {
    BluetoothManager.instance.requestPermissions();
    initRealm();

    runApp(const MyApp());
  });
}

void initRealm() {
  // 创建不同模型的 RealmManager 实例
  // peripheralManager = RealmManager<DSPeripheral>(realm);
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Pipedream Lighting',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        // 设置全局 AppBar 主题
        appBarTheme: const AppBarTheme(
          backgroundColor: Colors.white, // AppBar 背景颜色
          titleTextStyle: TextStyle(color: Colors.white, fontSize: 20, fontWeight: FontWeight.bold), // AppBar 标题文本颜色
        ),

        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: Myhome(),
      builder: EasyLoading.init(),
    );
  }
}
